<?php

namespace App\Models\Strator;

use App\Models\Traits\DateTimeTrait;
use App\Models\Traits\ModelSearchTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class StratorPro extends Model
{
    use SoftDeletes, DateTimeTrait, ModelSearchTrait;

    protected $dateFormat = 'Y-m-d H:i:s';
    protected $guarded = [];

    //
    public function searchConditions():array{
        return [
            ['name','like'],
            ['id','='],
            ['type_id','='],
            ['type_name_fill','like'],
        ];
    }

    //
    public function type(){
        return $this->belongsTo(StratorProductType::class,'type_id','id');
    }
    //
    public function sku(){
        return $this->hasMany(StratorProduct::class,'pro_id','id')->orderBy('sort', 'asc');;
    }

}
